﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mail_Box_Net_Disk.PublicTools
{
    class Tools
    {
        public static async Task ShowMessageDialog(string title, string s)
        {
            var msgDialog = new Windows.UI.Popups.MessageDialog(s) { Title = title };
            msgDialog.Commands.Add(new Windows.UI.Popups.UICommand(" (●'◡'●) "));
            await msgDialog.ShowAsync();
        }

        public static string FileSizeConvert(ulong size)
        {
            if (size < 1024)
            {
                return size.ToString() + "B";
            }
            else if (size / 1024 < 1024)
            {
                return ((float)size / 1024).ToString("0.00") + "KB";
            }
            else if (size / 1024 / 1024 < 1024)
            {
                return ((float)size / 1024 / 1024).ToString("0.00") + "MB";
            }
            else
            {
                return ((float)size / 1024 / 1024 / 1024).ToString("0.00") + "GB";
            }
        }
    }
}
